<?php
session_start();

/*
 * Neste script vamos guardar as mensagens na base de dados
 */

date_default_timezone_set('Europe/Lisbon');
$root = realpath($_SERVER["DOCUMENT_ROOT"]);

require_once "$root/serverResources/includes/db/ConnDBUser.php";
require_once "$root/serverResources/includes/classes/Chat.php";
include_once '../others/refreshSessionTime.php';

$chat=new Chat($_SESSION['projectID'], $_SESSION['groupID'], $_SESSION['userID'], $_SESSION['module']);

/*
 $info=array();
 array_push($info, $_POST);
 */

if(isset($_POST['message']) && isset($chat)){
	$chat->storeMessage($_POST['message']);
	unset($chat);
	echo $_POST['message'];
}


?>